package sctu.edu.java.year2016.team03.maoyuhao.lianxi.L1;

import java.util.*;

/**
 * Created by cc on 2016/6/1.
 */
public class CollectionDemo {
        public static void main(String[] args) {
            List<String> list=new ArrayList<String>();  //创建List集合对象
            list.add("apple");
            list.add("pear");
            list.add("banana");
            Set<String> set=new HashSet<String>();   //创建Set集合对象
            set.addAll(list);                       //将List集合添加到Set集合
            Iterator<String> it=set.iterator();     //创建Set迭代器
            while(it.hasNext()){
                System.out.println(it.next()+"\t");
            }

        }
    }
